package com.zyz.C_数组.练习;

/**
 * @author: vick
 * @Date: 2025/3/13
 * @Description:
 * @version: 1.0
 */
public class Demo1 {
    public static void main(String[] args) {
        int[] nums = {1, 2, 3, 4, 5};
        //初始化和
        int sum = 0;

        for (int num : nums) {
            sum +=num;
        }

        System.out.println("数组元素的和为：" + sum);
    }
}
